import 'package:flutter/material.dart';
import 'package:hrcapp/screens/welcome_screen.dart';
import 'package:hrcapp/screens/wallet_screen.dart';
import 'package:hrcapp/screens/asset_market_screen.dart';
import 'package:hrcapp/screens/profile_screen.dart';
import 'package:hrcapp/screens/trade_screen.dart';
import 'package:hrcapp/screens/home_screen.dart';
import 'package:hrcapp/screens/hrc_non_heritage_digitization_screen.dart';
import 'package:hrcapp/screens/hrc_authentication_evaluation_screen.dart';
import 'package:hrcapp/screens/hrc_evaluation_criteria_screen.dart';
import 'package:hrcapp/screens/hrc_asset_anchoring_screen.dart';
import 'package:hrcapp/screens/hrc_generate_token_screen.dart';
import 'package:hrcapp/screens/hrc_onchain_complete_screen.dart';
import 'package:hrcapp/screens/hrc_nft_onchain_detail_screen.dart';
import 'package:hrcapp/screens/hrc_digital_certificate_screen.dart';
import 'package:hrcapp/screens/hrc_asset_detail_screen.dart';
import 'package:hrcapp/screens/hrc_foundation_screen.dart';
import 'package:hrcapp/screens/login_screen.dart';
import 'package:hrcapp/screens/register_screen.dart';
import 'package:hrcapp/screens/nft_auction_screen.dart';
import 'package:hrcapp/screens/payment_screen.dart';
import 'package:hrcapp/screens/charity_screen.dart';
import 'package:hrcapp/screens/investor_center_screen.dart';
import 'package:hrcapp/screens/heritage_exhibition_screen.dart';
import 'package:hrcapp/screens/heritage_activities_screen.dart';

class AppRoutes {
  // 路由名称
  static const String welcome = '/welcome';
  static const String wallet = '/wallet';
  static const String assetMarket = '/assetMarket';
  static const String profile = '/profile';
  static const String trade = '/trade';
  static const String home = '/home';
  static const String digitization = '/digitization';
  static const String authenticationEvaluation = '/authenticationEvaluation';
  static const String evaluationCriteria = '/evaluationCriteria';
  static const String assetAnchoring = '/assetAnchoring';
  static const String generateToken = '/generateToken';
  static const String onchainComplete = '/onchainComplete';
  static const String nftOnchainDetail = '/nftOnchainDetail';
  static const String digitalCertificate = '/digitalCertificate';
  static const String assetDetail = '/assetDetail';
  static const String foundation = '/foundation';
  static const String login = '/login';
  static const String register = '/register';
  static const String nftAuction = '/nft_auction';
  static const String payment = '/payment';
  static const String charity = '/charity';
  static const String investorCenter = '/investorCenter';
  static const String heritageExhibition = '/heritageExhibition';
  static const String heritageActivities = '/heritage_activities';

  // 路由表
  static Map<String, WidgetBuilder> routes = {
    welcome: (context) => const WelcomeScreen(),
    wallet: (context) => const WalletScreen(),
    assetMarket: (context) => const AssetMarketScreen(),
    profile: (context) => const ProfileScreen(),
    trade: (context) => const TradeScreen(),
    home: (context) => const HomeScreen(),
    digitization: (context) => const HRCNonHeritageDigitizationScreen(),
    authenticationEvaluation: (context) => const HRCAuthenticationEvaluationScreen(),
    evaluationCriteria: (context) => const HRCEvaluationCriteriaScreen(),
    assetAnchoring: (context) => const HRCAssetAnchoringScreen(),
    generateToken: (context) => const HRCGenerateTokenScreen(),
    onchainComplete: (context) => const HRCOnchainCompleteScreen(),
    nftOnchainDetail: (context) => const HRCNFTOnchainDetailScreen(),
    digitalCertificate: (context) => const HRCDigitalCertificateScreen(),
    assetDetail: (context) => HRCAssetDetailScreen(assetData: ModalRoute.of(context)?.settings.arguments as Map<String, dynamic>? ?? {}),
    foundation: (context) => const HRCFoundationScreen(),
    login: (context) => const LoginScreen(),
    register: (context) => const RegisterScreen(),
    nftAuction: (context) => NFTAuctionScreen(nftData: ModalRoute.of(context)?.settings.arguments as Map<String, dynamic>? ?? {}),
    payment: (context) => const PaymentScreen(),
    charity: (context) => const CharityScreen(),
    investorCenter: (context) => const InvestorCenterScreen(),
    heritageExhibition: (context) => const HeritageExhibitionScreen(),
    heritageActivities: (context) => const HeritageActivitiesScreen(),
  };

  // 生成路由
  static Route<dynamic> generateRoute(RouteSettings settings) {
    switch (settings.name) {
      case wallet:
        return MaterialPageRoute(
          builder: (context) => const WalletScreen(),
        );
      case assetMarket:
        return MaterialPageRoute(
          builder: (context) => const AssetMarketScreen(),
        );
      case profile:
        return MaterialPageRoute(
          builder: (context) => const ProfileScreen(),
        );
      case trade:
        return MaterialPageRoute(
          builder: (context) => const TradeScreen(),
        );
      case home:
        return MaterialPageRoute(
          builder: (context) => const HomeScreen(),
        );
      case digitization:
        return MaterialPageRoute(
          builder: (context) => const HRCNonHeritageDigitizationScreen(),
        );
      case authenticationEvaluation:
        return MaterialPageRoute(
          builder: (context) => const HRCAuthenticationEvaluationScreen(),
        );
      case evaluationCriteria:
        return MaterialPageRoute(
          builder: (context) => const HRCEvaluationCriteriaScreen(),
        );
      case assetAnchoring:
        return MaterialPageRoute(
          builder: (context) => const HRCAssetAnchoringScreen(),
        );
      case generateToken:
        return MaterialPageRoute(
          builder: (context) => const HRCGenerateTokenScreen(),
        );
      case onchainComplete:
        return MaterialPageRoute(
          builder: (context) => const HRCOnchainCompleteScreen(),
        );
      case nftOnchainDetail:
        return MaterialPageRoute(
          builder: (context) => const HRCNFTOnchainDetailScreen(),
        );
      case digitalCertificate:
        return MaterialPageRoute(
          builder: (context) => const HRCDigitalCertificateScreen(),
        );
      case assetDetail:
        return MaterialPageRoute(
          builder: (context) => HRCAssetDetailScreen(
            assetData: ModalRoute.of(context)?.settings.arguments as Map<String, dynamic>? ?? {},
          ),
        );
      case foundation:
        return MaterialPageRoute(
          builder: (context) => const HRCFoundationScreen(),
        );
      case register:
        return MaterialPageRoute(
          builder: (context) => const RegisterScreen(),
        );
      case nftAuction:
        return MaterialPageRoute(
          builder: (context) => NFTAuctionScreen(
            nftData: settings.arguments as Map<String, dynamic>? ?? {},
          ),
        );
      case charity:
        return MaterialPageRoute(
          builder: (context) => const CharityScreen(),
        );
      case investorCenter:
        return MaterialPageRoute(
          builder: (context) => const InvestorCenterScreen(),
        );
      case heritageExhibition:
        return MaterialPageRoute(
          builder: (context) => const HeritageExhibitionScreen(),
        );
      case heritageActivities:
        return MaterialPageRoute(
          builder: (context) => const HeritageActivitiesScreen(),
        );
      default:
        return MaterialPageRoute(
          builder: (context) => const WelcomeScreen(),
        );
    }
  }
}